<template>
	<view class="box">
		
		<view class="info_box">
			<view class="title">{{info.title}}</view>
			<view class="time b_flex_c_s">
				<view v-if="info.createtime">发布于 {{info.createtime}}</view>
				<view v-if="info.ly">来源 {{info.ly}}</view>
				</view>
		<rich-text :nodes="info.content"></rich-text>
		
		<view class="img_box" v-if="info.video">
			<video class="v_video"  :src="info.video"></video>
		</view>
		
		</view>
	</view>
</template>

<script>
	
	export default{
		data(){
			return{
				info:{}
			}
		},
		onLoad(e){
		   if(e.id){
			   this.getInfo(e.id);
		   }	
		},
		methods:{
			getInfo(id){
				this.$get(this.$api.newsInfo,{id:id},res=>{
					let {code,data}=res.data;
					
					if(data.content){
						
						data.content = this.$formatRichText(data.content).replace(/src="\//g,
							'src="' + getApp().globalData
							.imgRemote + '/');
					}
					
					if(code==1){
						this.info=data;
					}
				});
			}
		}
	}
	
</script>

<style lang="scss" scoped>
	.box{
		background-color: white;
		min-height: 100vh;
	}
	.info_box{
		box-sizing: border-box;
		padding:30rpx;
		
	}
	.title{
		font-weight: 500;
		font-size: 38rpx;
	}
	.time{
		font-size: 24rpx;
		color: #A4A4A4;
		margin: 30rpx 0;
	}
	.img_box {
		margin-top: 20rpx;
	}
	.v_video {
		object-fit: cover;
		width: 100%;
		height: 350rpx;
	}
</style>
<style>
	image{
		max-width: 100%;
	}
</style>